package com.catnapgames.winfolders;


import java.io.File;


/**
 * The Java part of the Java-Win32 interface for SHGetSpecialFolderPath.
 * 
 * Use the predefined CSIDL_ constants as the parameter for
 * getSpecialFolderPath(). If you need a special path that isn't defined here,
 * simply look it up in shfolder.h
 * 
 */
public class WinFoldersJava {

	/** My Documents */
	public static final int CSIDL_PERSONAL = 0x0005;

	/** roaming, user\Application Data */
	public static final int CSIDL_APPDATA = 0x001a;

	/** non roaming, user\Local Settings\Application Data */
	public static final int CSIDL_LOCAL_APPDATA = 0x001C;

	/** My Pictures, new for Win2K */
	public static final int CSIDL_MYPICTURES = 0x0027;

	/** All Users\Application Data */
	public static final int CSIDL_COMMON_APPDATA = 0x0023;

	/** All Users\Documents */
	public static final int CSIDL_COMMON_DOCUMENTS = 0x002e;


	public static native String getSpecialFolderPath( int locationId );


	public static void main( String[] args ) {
		// The DLL needs to be loaded dynamically.
		// Adapt to your way of finding the file; here we assume it is in the current directory.
		// Load different DLLs according to whether the platform is 32 bit or 64 bit.
		String platform = System.getProperty("sun.arch.data.model").contains("64") ? "_x64" : "";
		System.load( new File( "" ).getAbsolutePath() + "\\WinFoldersJava" + platform + "-@VERSION@.dll" );

		System.out.println( "CSIDL_PERSONAL\t\t" + getSpecialFolderPath( CSIDL_PERSONAL ) );
		System.out.println( "CSIDL_APPDATA\t" + getSpecialFolderPath( CSIDL_APPDATA ) );
		System.out.println( "CSIDL_LOCAL_APPDATA\t" + getSpecialFolderPath( CSIDL_LOCAL_APPDATA ) );
		System.out.println( "CSIDL_MYPICTURES\t" + getSpecialFolderPath( CSIDL_MYPICTURES ) );
		System.out.println( "CSIDL_COMMON_APPDATA\t" + getSpecialFolderPath( CSIDL_COMMON_APPDATA ) );
		System.out.println( "CSIDL_COMMON_DOCUMENTS\t" + getSpecialFolderPath( CSIDL_COMMON_DOCUMENTS ) );
	}
}
